8 function isInt(d
: double) : boolean;
10 isInt
:= (floor(d
) = d
);
13 procedure miStringReplace(var s
: string; old
: char; nuevo
: char);
18 for i
:= 0 to length(s
) do
26 procedure printFloat(d
: double);
28 ReplaceFlags
: TReplaceFlags
;
31 s
:= format('$%f', [d
]);
32 miStringReplace(s
, ',', '.');
34 //writeln(StringReplace(format('$%f', [d]), ',', '.'));
35 //writeln(StringReplace(format('$%f', [d]), ',', '.' ReplaceFlags));
36 //writeln(StringReplace(formatFloat('$#0.00', d), ',', '.', ReplaceFlags));
40 s
: Array[0..1001] of double;
42 promedio
, mas
, menos
: double;
44 ReplaceFlags
: TReplaceFlags
;
47 //reset(input, 'inside.txt');
48 //reset(output, 'outside.txt');
58 promedio
:= promedio
+ s
[i
];
60 promedio
:= promedio
/ n
;
61 if (isInt(promedio
* 100)) then
66 promedio
:= floor(promedio
* 100) / 100;
68 //printFloat(promedio); writeLn('(Redondeado hacia abajo)');
71 if s
[i
] < promedio
then
72 menos
:= menos
+ abs(s
[i
] - promedio
)
74 if s
[i
] > promedio
then
77 mas
:= mas
+ abs(s
[i
] - (promedio
+ 0.01))
79 mas
:= mas
+ abs(s
[i
] - promedio
);